<?php

namespace App\Dao;

use App\Model\AreaModel;
use App\Model\BankModel;

class AreaDao extends BaseDao
{
    /**
     * @param $params
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public static function builder_query($params = []): \Illuminate\Database\Eloquent\Builder
    {
        $query = AreaModel::query();

        $query->when(checkIsHasField($params,'parentid'),function ($query)use ($params){
            $query->where('parentid',$params['parentid']);
        });


        return $query->orderByDesc('created_at');
    }
}
